import request from '@/config/axios'

// 充值赠品 VO
export interface PresentVO {
  id: number // ID
  userId: number // 用户ID
  userName: string // 用户名
  spuId: number // 赠品
  skuId: number // 商品库存ID
  presentCount: number // 赠品数量
  presentName: string // 赠品名称
  updateTime: Date // 修改时间
  creator: string // 创建人
  updater: string // 更新人
  deleted: boolean // 是否删除
  tenantId: number // 租户ID
}

// 充值赠品 API
export const PresentApi = {
  // 查询充值赠品分页
  getPresentPage: async (params: any) => {
    return await request.get({ url: `/promotion/present/page`, params })
  },

  // 查询充值赠品详情
  getPresent: async (id: number) => {
    return await request.get({ url: `/promotion/present/get?id=` + id })
  },

  // 新增充值赠品
  createPresent: async (data: PresentVO) => {
    return await request.post({ url: `/promotion/present/create`, data })
  },

  // 修改充值赠品
  updatePresent: async (data: PresentVO) => {
    return await request.put({ url: `/promotion/present/update`, data })
  },

  // 删除充值赠品
  deletePresent: async (id: number) => {
    return await request.delete({ url: `/promotion/present/delete?id=` + id })
  },

  // 导出充值赠品 Excel
  exportPresent: async (params) => {
    return await request.download({ url: `/promotion/present/export-excel`, params })
  },
}